<?php

namespace App\Store\Validate\Sysset;

use App\Common\Validate\BaseValidate;

/**
 * 权限组验证器
 */
class GoodsSendpoints extends BaseValidate
{

    //验证规则
    protected $rule = [];
    //自定义验证信息
    protected $message = [];
    

    public function __construct($doaction = 'add')
    {
        if ($doaction == 'add') {
            $this->rule = [
                'store_id' => 'required|integer|gt:0',
                // 'goods_category_ids' => 'required',
                'points_num' => 'required|integer|gt:0',
                'share_mem_points_scale'=>'required|integer|gt:0',
                'type'=>'required|in:1,2,3',
            ];
            $this->message = [
                'store_id.required' => '门店未选择',
                'store_id.integer' => '门店未选择',
                'store_id.gt' => '门店未选择',
                // 'goods_category_ids.required' => '商品类别未选择',
                'points_num.required' => '积分值不能为空',
                'points_num.integer' => '积分值必须为整数',
                'points_num.gt' => '积分值必须大于0',
                'share_mem_points_scale.required' => '推荐积分比例不能为空',
                'share_mem_points_scale.integer' => '推荐积分比例必须为整数',
                'share_mem_points_scale.gt' => '推荐积分比例必须大于0',
                'type.required' => '积分规则未选择',
                'type.in' => '积分规则参数错误',
            ];
        } elseif ($doaction == 'edit') {
            $this->rule = [
                'id' => 'required|integer|gt:0',
                'points_num' => 'required|integer|gt:0',
                'share_mem_points_scale'=>'required|integer|gt:0',
            ];
            $this->message = [
                'id.required' => '参数错误',
                'id.integer' => '参数错误',
                'id.gt' => '参数错误',
                'points_num.required' => '积分值不能为空',
                'points_num.integer' => '积分值必须为整数',
                'points_num.gt' => '积分值必须大于0',
                'share_mem_points_scale.required' => '推荐积分比例不能为空',
                'share_mem_points_scale.integer' => '推荐积分比例必须为整数',
                'share_mem_points_scale.gt' => '推荐积分比例必须大于0',
            ];
        }
    }
}
